import type { DatePickerProps } from "antd";
import { DatePicker, Button } from "antd";

import { useSelector, useDispatch } from 'react-redux';
import { increment, decrement, reset } from '@/store/modules/count';
const onChange: DatePickerProps["onChange"] = (date, dateString) => {
  console.log(date, dateString);
};

export default function Home() {
  const count = useSelector((state: { counter: { count: number } }) => state.counter.count);
  const dispatch = useDispatch();  // 获取 dispatch 函数

  return (
    <div>
      <h1>🚧 页面施工中Home</h1>
      <p>该页面正在建设中，敬请期待</p>
      <a href="/">返回首页</a>
      <h1>Count: {count}</h1>
      <DatePicker onChange={onChange} />
      <Button onClick={() => dispatch(increment())}>Increment</Button>
      <Button onClick={() => dispatch(decrement())}>Decrement</Button>
      <Button onClick={() => dispatch(reset())}>Reset</Button>
    </div>
  );
}